<script type="text/javascript">
	function areyousure(obj, e){
		if(!confirm('Bạn muốn xóa?')){
			e.preventDefault();
			return false;
		}
		return true;
	}
</script>

<form role="form" class="form" action="<?php echo base_url('admin/users/change_password');?>" method="post">
	<div class="span3">	
		<div class="form-group">
			<label for="" class="col-sm-2 control-label">Mật khẩu</label>
			<div class="col-sm-10">
				<input class="form-control" type="password" name="password" />
			</div>
		</div>
	</div>
	<div class="span3">
		<div class="form-group">
			<label for="" class="col-sm-2 control-label">Nhập lại</label>
			<div class="col-sm-10">
				<input class="form-control" type="password" name="repassword" />
			</div>
		</div>
	</div>
	<div class="span3">	
		<div class="form-group">
			<label for="" class="col-sm-2 control-label">&nbsp;</label>
			<div class="col-sm-offset-2 col-sm-10">
				<button type="submit" class="btn btn-default">Đổi mật khẩu</button>
			</div>
		</div>	
	</div>
</form>
<div style="clear:both;"></div>
<?php if(is_admin_role('admin')):?>
<div class="btn-group pull-right">
	<a class="btn" href="<?php echo base_url('admin/users/form'); ?>"><i class="icon-plus-sign"></i> Thêm mới User</a>
</div>

<div class="page-header">
	<h1>Users <small>All users</small></h1>
</div>
<table class="table table-striped table-bordered table-condensed">
	<thead>
		<tr>
			<th>ID</th>
			<th>Username</th>
			<th>Name</th>
			<th>Email</th>				
			<th>Role</th>
			<th>Status</th>
			<th></th>
		</tr>
	</thead>
	<tbody>
	<?php if($users):
		$i = 0;
		foreach($users as $user): $i++;
	?>
		<tr class="list-users">
			<td><?=$i?></td>
			<td><?=$user->username?></td>
			<td><?=$user->ho_ten?></td>
			<td><?=$user->email?></td>
			<td><?=$user->role?></td>
			<td>
				<?php if($user->status == 1):?>
				<span class="label label-success">Active</span>
				<?php else:?>
				<span class="label label-important">Inactive</span>
				<?php endif;?>
			</td>
			<td>
				<div class="btn-group">
					<a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">Actions <span class="caret"></span></a>
					<ul class="dropdown-menu pull-right">
						<li><a href="<?php echo base_url('admin/users/form/'.$user->id); ?>"><i class="icon-pencil"></i> Edit</a></li>
						<li><a onclick="areyousure(this,event);" href="<?php echo base_url('admin/users/delete/'.$user->id); ?>"><i class="icon-trash"></i> Delete</a></li>
						<?/*
						<li class="nav-header">Permissions</li>
						<li><a href="<?php echo base_url('admin/users/admin/'.$user->id); ?>"><i class="icon-lock"></i> Make <strong>Admin</strong></a></li>
						<li><a href="<?php echo base_url('admin/users/editor/'.$user->id); ?>"><i class="icon-lock"></i> Make <strong>Editor</strong></a></li>
						<li><a href="<?php echo base_url('admin/users/viewer/'.$user->id); ?>"><i class="icon-lock"></i> Make <strong>Viewer</strong></a></li>*/?>
					</ul>
				</div>
			</td>
		</tr>
	<?php endforeach;
		endif;
	?>
	</tbody>
</table>
<?/*
<div class="pagination">
	<ul>
		<li><a href="#">Prev</a></li>
		<li class="active">
			<a href="#">1</a>
		</li>
		<li><a href="#">2</a></li>
		<li><a href="#">3</a></li>
		<li><a href="#">4</a></li>
		<li><a href="#">Next</a></li>
	</ul>
</div>*/?>
<?php endif;?>